/*
 * ABCDEF.cxx
 *
 *  Created on: 11:29:50 PM Sep 18, 2012
 *      Author: Pallab
 * "I have not failed, I have just found 10000 ways that won't work.
 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define foR(i1,st,ed) for(int i1 = st , j1 = ed ; i1 < j1 ; ++i1 )
#define fo(i1,ed) foR( i1 , 0 , ed )
#define foE(i1,st,ed) foR( i1, st, ed+1 )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )
#define line puts("")

inline void wait(double seconds) {
	double endtime = clock() + (seconds * CLOCKS_PER_SEC);
	while (clock() < endtime) {
		;
	}
}
#define T int
inline T fastIn() {
	register char c = 0;
	register T a = 0;
	bool neg = false;
	while (c < 33)
		c = getchar();
	while (c > 33) {
		if (c == '-') {
			neg = true;
		} else {
			a = (a * 10) + (c - '0');
		}
		c = getchar();
	}
	return neg ? -a : a;
}
inline void myOut(T a) {
	if (a) {
		int v = a % 10;
		myOut(a / 10);
		putchar((char) (v + '0'));
	}

}
inline void fastOut(T a) {
	if (a == T(0)) {
		putchar('0');
	} else if (a < T(0)) {
		putchar('-');
		myOut(-a);
	} else {
		myOut(a);
	}
}
const int MX = 101;
int n;
int num[MX];
inline void read() {
	n = fastIn();
	fo(i,n){
		num[i] = fastIn();
	}
}
const int mx = 1000001;
int vi1[mx];
int cnt1;
int vi2[mx];
int cnt2;

inline void proc() {
	cnt1 = 0;
	fo(i,n)
		fo(j,n)
			fo(k,n)
				vi1[cnt1++] = (num[i] * num[j]) + num[k];
	fo(i,n)
		fo(j,n)
			fo(k,n){
				if (num[k])
					vi2[cnt2++] = (num[i] + num[j]) * num[k];
			}


	sort(vi1,vi1+cnt1,less<int>());
	sort(vi2,vi2+cnt2,less<int>());
	int res=0;
	for(int i=0;i<cnt2;){
		int _i=i;
		int cnt=0;
		int l = lower_bound(vi1,vi1+cnt1, vi2[_i])-vi1;
		int h = upper_bound(vi1,vi1+cnt1, vi2[_i])-vi1;
		int d=(h-l<0?0:(h-l));
		while( i<cnt2 && vi2[_i]==vi2[i] ){
			++cnt;
			++i;
		}
		res+= (cnt*d);
	}
	fastOut(res);
	line;
}
//#define ME
int main() {
	int kase = 1;
#if defined ( ME )
	freopen("in", "r", stdin);
	kase = 1;
#endif
	fo(i,kase)
	{
		read();
		proc();
	}
	return 0;
}

